Thread: incompatible type for argument 1 of `CoCreateInstance

  1. #1
    Registered User
    Join Date
    Jul 2007
    Posts
    7

    incompatible type for argument 1 of `CoCreateInstance

    hey guys, i've been googling for over an hour and haven't found anything that helped, so i thought i'd post here to see if anyone can help me solve my problem, here is my source

    Code:
    #include <windows.h>
    #include "msgrua.h"
    #include "msgruaid.h"
    
    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)  
    {
       IMessenger *pIMessenger;
       CoCreateInstance(CLSID_Messenger, NULL, CLSCTX_ALL, IID_IMessenger, (void **)&pIMessenger);
       return 0;
    }
    and when i try to compile i get the following errors:
    Code:
    incompatible type for argument 1 of `CoCreateInstance' 
    incompatible type for argument 4 of `CoCreateInstance'
    i know the error is telling me that the arguments 1 and 4 inside CoCreateInstance are not compatible, but i have no idea why, im using dev-cpp if it helps, thanks in advance.

  2. #2
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    Well, it would really help if you actually showed us how the variables you're using for arguments 1 and 4 were declared. The variable names alone is absolutely no use to us at all whatsoever.

    Other than that, RTFM.
    If you understand what you're doing, you're not learning anything.

  3. #3
    Registered User
    Join Date
    Jul 2007
    Posts
    7
    Quote Originally Posted by itsme86 View Post
    Well, it would really help if you actually showed us how the variables you're using for arguments 1 and 4 were declared. The variable names alone is absolutely no use to us at all whatsoever.

    Other than that, RTFM.
    they are defined in the header file "msgrua.h"

    Code:
    EXTERN_C const CLSID CLSID_Messenger;
    EXTERN_C const IID IID_IMessenger;

  4. #4
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    And according to the page I linked, are arguments 1 and 4 types CLSID and IID? Looks like you found your why.

    Try passing the address of those variables instead maybe.
    If you understand what you're doing, you're not learning anything.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can you check what is wrong with this code
    By Ron in forum C++ Programming
    Replies: 4
    Last Post: 08-01-2008, 10:59 PM
  2. strings Vs. Char pointers
    By aijazbaig1 in forum C Programming
    Replies: 49
    Last Post: 02-13-2008, 09:51 AM
  3. Using VC Toolkit 2003
    By Noobwaker in forum Windows Programming
    Replies: 8
    Last Post: 03-13-2006, 07:33 AM
  4. incompatible type
    By desertstorm in forum C Programming
    Replies: 3
    Last Post: 11-30-2005, 03:23 PM
  5. Learning OpenGL
    By HQSneaker in forum C++ Programming
    Replies: 7
    Last Post: 08-06-2004, 08:57 AM